#include "ScenarioPanel.h"

ScenarioPanel::ScenarioPanel(int xPos, int yPos,Widget* parent) :
		Container(xPos, yPos,NULL, parent) {
	parcel = getPosition();
}

void ScenarioPanel::setElements(std::list<Widget*> scenaryElements) {
	Widget* element = NULL;
	std::list<Widget*>::iterator it_aux;
	for (it_aux = scenaryElements.begin(); it_aux != scenaryElements.end();
			++it_aux) {
		element = (*it_aux);

		this->elements.push_back(element);

		add(element);
	}
}

ScenarioPanel::~ScenarioPanel() {

}

void ScenarioPanel::handleEvent(Event event) {
	for (it_widget = widgets.begin(); it_widget != widgets.end(); ++it_widget) {
		((Widget*) *it_widget)->handleEvent(event);
	}
}

void ScenarioPanel::resolve() {
	for (it_widget = widgets.begin(); it_widget != widgets.end(); ++it_widget) {
		((Widget*) *it_widget)->resolve();
	}
}

void ScenarioPanel::showOn(SDL_Surface *surface) {

	for (it_widget = widgets.begin(); it_widget != widgets.end(); ++it_widget) {
		((Widget*) *it_widget)->showOn(surface);
	}
}
